package bdqn.t09.controller;

import bdqn.t09.pojo.AsSystemconfig;
import bdqn.t09.service.AsAccountdetailService;
import bdqn.t09.service.AsSystemconfigService;
import bdqn.t09.util.Pageinfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class AgentPrepaymentController {

    @Resource
    private AsAccountdetailService accountdetailService;

    @Resource
    private AsSystemconfigService systemconfigService;

    //访问代理商预付款页面
    @GetMapping("/agentPrepayment")
    public String toAgentPrepayment(){
        return "agentPrepayment";
    }

    //按条件查询账户信息
    @GetMapping("/configInfoBy")
    @ResponseBody
    public Object getPrepaymentInfoBy(@RequestParam(value="page",defaultValue = "1") Integer page,
                                      @RequestParam(value="rows",defaultValue = "10") Integer rows,
                                      @RequestParam(value="id",defaultValue = "0") Integer id,
                                      @RequestParam(value="beginDate",defaultValue = "") String beginDate,
                                      @RequestParam(value="endDate",defaultValue = "") String endDate){
        Pageinfo pageinfo = accountdetailService.selectBy(page, rows,id,beginDate,endDate);
        return pageinfo;
    }

    //获取配置信息
    @PostMapping("/configInfo")
    @ResponseBody
    public Object getConfigInfo(){
        List<AsSystemconfig> configList = systemconfigService.findConfigById(1);
        return configList;
    }
}

